package base.multithreading.testyield;

public class TestYield {
    public static void main(String[] args) {
        YieldRunnable yieldRunnable=new YieldRunnable();
        new Thread(yieldRunnable,"TA").start();
        new Thread(yieldRunnable,"TB").start();
    }
}
class YieldRunnable implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "线程开始执行");
        Thread.yield();
        System.out.println(Thread.currentThread().getName() + "线程结束运行");
    }
}
